package com.shuda.business.user.service;

import com.shuda.db.user.entity.Menu;
import com.shuda.db.user.mapper.MenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuDbService {
    
    @Autowired
    private MenuMapper menuMapper;
    
    public Menu getById(Long id) {
        return menuMapper.selectById(id);
    }
    
    public List<Menu> getList() {
        return menuMapper.selectList(null);
    }
    
    public boolean insert(Menu menu) {
        return menuMapper.insert(menu) > 0;
    }
    
    public boolean update(Menu menu) {
        return menuMapper.updateById(menu) > 0;
    }
    
    public boolean delete(Long id) {
        return menuMapper.deleteById(id) > 0;
    }
}